package com.example.Handler;

import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

import com.examplee.username.httpfrist_01.R;

import org.w3c.dom.Text;

public class HandlerpostActivity extends AppCompatActivity {
TextView text1;
    Handler mHandler=new Handler();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_handlerpost);
        text1= (TextView) findViewById(R.id.text1);
        new Thread(){

            @Override
            public void run() {
                try {
                    Thread.sleep(2000);
                    mHandler.post(new Runnable() {
                        @Override
                        public void run() {
                            text1.setText("updata Handler");
                        }
                    });
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }.start();
    }
}
